
class MockRiakObj(object):
    def __init__(self, key=None, data=None):
        self.key = key
        self.data = data
        
    def store(self):
        return
        
    def exists(self):
        return self._bucket.exists(self.key)
        
    def set_data(self, d):
        self.data = d
        
    def get_data(self):
        return self.data
   
    def add_index(self, name, type):
       pass
   
   
class MockBucket(object):
    def __init__(self):
        self.data = {}
     
    def exists(self, key):
        return key in self.data
        
    def get(self, key):
        obj = MockRiakObj(key, self.data.get(key, None))
        obj._bucket = self
        return obj
        
    def new(self, key, data=None):
        self.data[key] = data
        return MockRiakObj()

class MockClient(object):
    def bucket(self, name):
        return MockBucket()
